﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace msBsc.WebUi.mMall.Buyer
{
    public partial class mfCustomerSuggestion : msBsc.Cls.mbPCustom
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public override void DoAction()
        {
            if (strAction == "submitSuggest")
            {
                SubmitSuggestion();
            }
        }

        private void SubmitSuggestion()
        {
            string email = this.GetParamHtValue("email");
            string phone = this.GetParamHtValue("phone");
            string pagelink = this.GetParamHtValue("pagelink");
            string content = this.GetParamHtValue("content");
            string pagename = this.GetParamHtValue("pagename");
            if (string.IsNullOrEmpty(content))
            {
                this.Alert("建议不能为空，请填写建议内容");
                return;
            }

            if (content.Length > 1000)
            {
                this.Alert("建议内容不能超过1000个字符");
                return;
            }

            string result = string.Empty;

            using (msBsc.AppLogic.DataAlc.CBizDjkSiteSuggestion objCBizDjkSiteSuggestion = new msBsc.AppLogic.DataAlc.CBizDjkSiteSuggestion())
            {
                result = objCBizDjkSiteSuggestion.AddSuggestion(pagename, content, pagelink, email, phone);
            }

            if (result != "OK")
            {
                this.Alert(result);
                return;
            }

            this.Alert("提交建议成功，感谢您对本网站的支持！\r\n我们将根据您的建议，尽快做出修改！");
            this.ExecJScript("Reset()");
        }
    }
}